home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1999 Spring / macformat-077.iso / Shareware Plus / Development / Akua Sweets 131 / Akua Sweets Examples / Printing / Show Printer Config < prev    next >
Encoding:
Text File  |  1999-03-04  |  3.0 KB  |  95 lines  |  [TEXT/ToyS]

  1. property kasLoc : {40, 60}
  2.  
  3.  
  4. on run
  5.     set pc to printer configuration
  6.     set infW to (display info titled "Current Printer" message PrinterName(pc) located at kasLoc)
  7.     
  8.     set n to ShowLine(infW, 2, -1, "", "")
  9.     set n to ShowLine(infW, n, -1, "", "")
  10.     set n to ShowLine(infW, n, -1, "", "")
  11.     set n to ShowLine(infW, n, -1, "", "")
  12.     set n to ShowLine(infW, n, -1, "", "")
  13.     set n to ShowLine(infW, n, -1, "", "")
  14.     
  15.     set clr to 26 * 1024 + 29 * 32 + 26
  16.     set n to ShowLine(infW, n, clr, "LAN Name", LAN printer name of pc)
  17.     set n to ShowLine(infW, n, clr, "LAN Type", LAN printer type of pc)
  18.     set n to ShowLine(infW, n, clr, "LAN Zone", LAN printer zone of pc)
  19.     set n to ShowLine(infW, n, clr, "Driver", print driver name of pc)
  20.     set n to ShowLine(infW, n, clr, "Paper Area", RectString(paper area of pc))
  21.     
  22.     set n to ShowLine(infW, n, -1, "Info", "")
  23.     set pci to printer info of pc
  24.     set clr to 26 * 1024 + 26 * 32 + 29
  25.     set n to ShowLine(infW, n, clr, "Port DPI", PointString({printer hres of pci, printer vres of pci}))
  26.     set n to ShowLine(infW, n, clr, "Port Area", RectString(printable area of pci))
  27.     
  28.     set n to ShowLine(infW, n, -1, "Device", "")
  29.     set pcd to printer device info of pc
  30.     set clr to 29 * 1024 + 26 * 32 + 26
  31.     set n to ShowLine(infW, n, clr, "Device DPI", PointString({printer hres of pcd, printer vres of pcd}))
  32.     set n to ShowLine(infW, n, clr, "Driver Area", RectString(printable area of pcd))
  33.     
  34.     set n to ShowLine(infW, n, -1, "Paper", "")
  35.     set pcs to paper style of pc
  36.     set clr to 29 * 1024 + 29 * 32 + 26
  37.     set n to ShowLine(infW, n, clr, "Page Height", page height of pcs)
  38.     set n to ShowLine(infW, n, clr, "Page Width", page width of pcs)
  39.     
  40.     set n to ShowLine(infW, n, -1, "Job", "")
  41.     set pcj to print job of pc
  42.     set clr to 26 * 1024 + 29 * 32 + 29
  43.     set n to ShowLine(infW, n, clr, "First Page", first job page of pcj)
  44.     set n to ShowLine(infW, n, clr, "Last Page", last job page of pcj)
  45.     set n to ShowLine(infW, n, clr, "Copies", job copies of pcj)
  46.     
  47.     -- Not good practice -- drawing into an info window :)
  48.     draw a picture into infW ¬
  49.         using data (PrinterIcon(pc) as picture) ¬
  50.         inside of {90, 16, 154, 80}
  51.     
  52.     pause for 10 with seconds timing
  53.     
  54.     set kasLoc to screen location of (display info infW with disposal)
  55. end run
  56.  
  57.  
  58. on RectString(box)
  59.     return PointString(items 1 thru 2 of box) & ":" & PointString(items 3 thru 4 of box)
  60. end RectString
  61.  
  62.  
  63. on PointString(pt)
  64.     return "(" & item 1 of pt & ¬
  65.         ", " & item 2 of pt & ")"
  66. end PointString
  67.  
  68.  
  69. on ShowLine(w, lineNo, clr, lbl, txt)
  70.     set lbl to recompose lbl padded to 20
  71.     set txt to recompose txt padded to -20
  72.     display info w message (lbl & txt) at line lineNo ¬
  73.         using font "Courier" using size 10 ¬
  74.         using bg color clr
  75.     return lineNo + 1
  76. end ShowLine
  77.  
  78.  
  79. on PrinterName(prCfg)
  80.     set choice to desktop printer name of prCfg
  81.     if (choice is "") then set choice to (LAN printer name of prCfg)
  82.     if (choice is "") then set choice to print driver name of prCfg
  83.     return choice
  84. end PrinterName
  85.  
  86.  
  87. on PrinterIcon(pc)
  88.     try
  89.         set ic to desktop icon of pc
  90.     on error
  91.         set ic to the icon for (print driver alias of pc)
  92.     end try
  93.     return ic
  94. end PrinterIcon
  95.